<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<%@taglib  uri="http://www.jicresoft.com/oa/functions" prefix="p"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<link href="css/table.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/table.js"></script>
		<script type="text/javascript" src="js/openwindow.js"></script>
		<script type="text/javascript">
	function page(currentPage){
		$("#pageId").val(currentPage);
		document.pageForm.submit();
	}
function clearInfo(){
	$("#formName").val("");
	document.searchForm.submit();
}	

function initadd(){
	var url="form_init.action?status=add";
	openWindow(url,650,400);
}	
function checkAll(){
	var all=$("#all");
	var checks=$("input[name='ids']");
	if(all.attr("checked")){
		checks.attr("checked","checked");
	}else{
		checks.attr("checked","");
	}
}

function deleteForm(){
	
	var arry="";
	var count=0;
	var checks=$("input[name='ids']");
	for(var i=0;i<checks.length;i++){
		if(checks[i].checked){
			if(arry==''){
			arry+="ids="+checks[i].value;
			}else{
			arry+="&ids="+checks[i].value;
			}
			count++;
		}
	}
	if(count==0){
		alert("请选择要删除的数据！");
		return;
	}
	if(confirm("确定要删除？")){
		$.post("deleteFlowForm.action",arry,function(data){
			if(data=="success"){
				alert("删除数据成功！");
				var currentPage=$("#currentPage").val();
				page(currentPage);
			}else{
				alert("删除数据失败！");
			}
		});
	}
}

function updateForm(id){
var currentPage=$("#currentPage").val();
 var url="getFlowFormById.action?formId="+id+"&currentPage="+currentPage;
 openWindow(url,650,400);
}

function proportyManager(id){
	window.location.href="flowFormProportyManager.action?formId="+id;
}

</script>

	</head>

	<body>
		<div class="topdiv">
			<form action="flowFormManager.action" method="post" name="searchForm">
				<div>
					数据表名称：
					<input type="text" id="formName" name="formName"
						value="${formName}" />
				</div>
				<table align="right">
					<tr>
						<td>
							<input type="submit" value="立即查找" class="button_04" />
							<input type="button" onclick="clearInfo();" value="清除"
								class="button_02" />
						</td>
					</tr>
				</table>
			</form>
		</div>

		<table  border="0" cellpadding="0" cellspacing="0" width="100%">
			<tbody>
				<tr>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
					<td style="background: url('image/wsoa_window_002.gif');">
						<table border="0" cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"
										width="10">
										<img src="image/center_19.gif">
									</td>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"></td>
									<td>
										系统管理 &gt; 自定义平台 &gt; 数据库管理
									</td>
								</tr>
							</tbody>
						</table>
					</td>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
				</tr>
				<tr>
					<td style="background: url('image/wsoa_window_010.gif');" width="1">
						&nbsp;
					</td>
					<td>
						<table class="intable">
							<tr>
								<td>
									<input type="button" onclick="initadd()" value="添加"
										class="button_02" />
								</td>
								<td>
									<input type="button" onclick="deleteForm()" value="删除"
										class="button_02" />
								</td>
							</tr>
						</table>

						<table id="tabllist" class="righ_list" frame="box" cellspacing="1"
							cellpadding="0" width="100%" border="0">
							<tr class="reigh_list2">
								<th align="left" class="bg_tr" width="5%">
									<input type="checkbox" onclick="checkAll()" id="all">
								</th>
								<th align="left" >
									数据表名称
								</th>
								<th align="left" width="15%">
									系统名称
								</th>
								<th align="left" width="15%">
									创建人
								</th>
								<th align="left" width="15%">
									 创建时间
								</th>
								<th align="left" width="10%">
									操作
								</th>
							</tr>
							<c:if test="${empty formList}">
								<tr id="row">
									<td colspan="6">
										没有相关记录！
									</td>
								</tr>
							</c:if>
							<c:forEach items="${formList}" var="form">
								<tr id="row" onmouseover="overStyle(this)"
									onmouseout="outStyle(this)">
									<td align="center" width="5%">
										<c:if test="${p:hasPermission(form.userId,sessionScope.userInfo.id)}">
										<input type="checkbox" name="ids" value="${form.id}">
										</c:if>
									</td>
									<td >
										${form.formName}
									</td>
									<td width="15%">
										${form.tableName}
									</td>
									<td width="15%">
										${form.userName}
									</td>
									<td width="15%">
										<fmt:formatDate value="${form.createTime}" pattern="yyyy-MM-dd"/>
									</td>
									<td align="center" width="10%">
									<c:if test="${p:hasPermission(form.userId,sessionScope.userInfo.id)}">
										<img alt="修改" onclick="updateForm('${form.id}')"
											src="image/operate_update.gif" style="cursor: pointer">
										&nbsp;&nbsp;
										<a href="javascript:proportyManager('${form.id}')"><img src="image/standardpart.gif" alt="设置" border="0"/></a>
										</c:if>
									</td>
								</tr>
							</c:forEach>
						</table>

					</td>
					<td style="background: url('image/wsoa_window_006.gif');" width="1">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td height="1" width="1">
						<img src="image/wsoa_window_009.gif" height="16" width="14">
					</td>
					<td style="background: url('image/wsoa_window_008.gif');"
						height="1"></td>
					<td height="1" width="1">
						<img src="image/wsoa_window_007.gif" height="16" width="12">
					</td>
				</tr>
			</tbody>
		</table>
		<div class="pageDiv">
			<form action="flowFormManager.action" method="post" name="pageForm">
				<input type="hidden" name="formName" value="${formName}">
				<input type="hidden" id="pageId" name="currentPage">
				<%@include file="../page/page.jsp"%>
			</form>
		</div>
	</body>
</html>